package top.yonyong.java8.G访问接口的默认方法;

import java.util.Optional;

/**
 * @author yonyong
 **/
public class TestOptional {
    public static void main(String[] args) {
        Optional<String> optionalS = Optional.of("hello");
        System.out.println(optionalS.isPresent());
        System.out.println(optionalS.get());
        System.out.println(optionalS.orElse("orElse"));
        optionalS.ifPresent(System.out::println);

        Optional<String> optionalO = Optional.of("");
        System.out.println(optionalO.isPresent());
    }
}
